package com.chena.common.exception;

/**
 * 自定义异常
 */
public class ServiceException extends RuntimeException {
	private static final long serialVersionUID = 1L;
	
	/**
	 * 成功
	 */
	public static final int FAILED = 01;
	/**
	 * 失败
	 */
	public static final int SUCCESS = 00;
	
	private int code = 500;
	private String msg;
	private Object data; // 异常数据

	public ServiceException(String msg) {
		super(msg);
		this.msg = msg;
	}
	
	public ServiceException(String msg, Throwable e) {
		super(msg, e);
		this.msg = msg;
	}
	
	public ServiceException(String msg, int code) {
		super(msg);
		this.msg = msg;
		this.code = code;
	}
	
	public ServiceException(int code, String message) {
		super(message);
		this.msg = message;
		this.code = code;
	}
	
	public ServiceException(String msg, int code, Throwable e) {
		super(msg, e);
		this.msg = msg;
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	
	
	
}
